﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YanZhiwei.DotNet2.Utilities.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace YanZhiwei.DotNet2.Utilities.Common.Tests
{
    [TestClass()]
    public class ArrayHelperTests
    {
        [TestMethod()]
        public void CopyTest()
        {
            int[] _actual = ArrayHelper.Copy(new int[5] { 1, 2, 3, 4, 5 }, 0, 3);
            CollectionAssert.AreEqual(new int[3] { 1, 2, 3 }, _actual);
        }

        [TestMethod()]
        public void EqualsTest()
        {
            bool _actual = ArrayHelper.Equals(new int[5] { 1, 2, 3, 4, 5 }, new int[5] { 1, 2, 3, 4, 5 });
            Assert.IsTrue(_actual);
        }

        [TestMethod()]
        public void InsertTest()
        {
            int[] _actual = ArrayHelper.Insert(new int[5] { 1, 2, 3, 4, 5 }, 3, 0);
            CollectionAssert.AreEqual(new int[6] { 3, 2, 3, 4, 5, 1 }, _actual);
        }

        [TestMethod()]
        public void IsNullOrEmptyTest()
        {
            bool _actual = ArrayHelper.IsNullOrEmpty(new int[0]);
            Assert.IsTrue(_actual);
        }

        [TestMethod()]
        public void AddTest()
        {
            int[] _actual = ArrayHelper.Add(new int[5] { 1, 2, 3, 4, 5 }, 6);
            CollectionAssert.AreEqual(new int[6] { 1, 2, 3, 4, 5, 6 }, _actual);
        }

        [TestMethod()]
        public void AddRangeTest()
        {
            int[] _actual = ArrayHelper.AddRange(new int[5] { 1, 2, 3, 4, 5 }, new int[2] { 6, 7 });
            CollectionAssert.AreEqual(new int[7] { 1, 2, 3, 4, 5, 6, 7 }, _actual);
        }
    }
}
